package fem2.jlinalg;

import inf.jlinalg.SolveFailedException;

import org.junit.Test;

import fem2.Debugger;
import fem2.enu.PETScPrecondType;

public class PETScLSESolverTest {

	@Test
	public void test1() throws SolveFailedException {

		double val[] = { 1, 1, 0, 1, 1, 1, 0, 1, 1 };
		double b[] = { 1, 2, 3 };

		// String[] argv = new String[] { "-ksp_view" };
		// Solver s = new PETScLSESolver(argv);

		Solver s = new PETScLSESolver();

		s.setSize(3);
		s.initialize();

		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < 3; j++) {
				s.getA().set(i, j, val[3 * i + j]);
			}
		}

		((PETScLSESolver) s).setPC(PETScPrecondType.PCJACOBI);

		s.solve(b);

		Debugger.watch(b);
	}
}
